﻿<%@ Page Title="Consulta de Prestamos" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Prestamos.aspx.cs" Inherits="Triunfadores.Web.Prestamos.PagarCuotas" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    
    <div class="box box-primary">
        <div class="box-header with-border">
            <h3 class="box-title">Buscar</h3>
            <div class="box-tools pull-right">
                <button title="Collapse" data-toggle="tooltip" data-widget="collapse" class="btn btn-box-tool"><i class="fa fa-minus"></i></button>
            </div>
        </div>
        <div class="box-body">
            <div class="form-horizontal">
                <div class="form-group">
                    <label class="control-label col-md-1">DNI</label>
                    <div class="col-md-4">
                        <asp:TextBox ID="tbxDniSocio" CssClass="form-control input-sm" MaxLength="8" runat="server" />
                    </div>
                    <div class="col-md-1">
                        <asp:Button ID="btnBuscarSocio" CssClass="btn btn-sm btn-default" Text="Buscar" runat="server" />
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    <div class="box box-primary">
        <div class="box-header with-border">
            <h3 class="box-title">Prestamos</h3>
        </div>
        <div class="box-body">
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <asp:ListView ID="lvPrestamos"
                        ItemType="Triunfadores.BusinessEntities.Prestamo"
                        runat="server"
                        SelectMethod="GetPrestamosByDniSocio">
                        <EmptyDataTemplate>
                            <h3 class="message-error" align="center"><b>Este cliente no tiene prestamos</b></h3>
                        </EmptyDataTemplate>
                        <LayoutTemplate>
                            <table class="table table-hover">
                                <thead>
                                    <tr>
                                        <th>Fecha de registro</th>
                                        <th>Nro de cuotas</th>
                                        <th>Monto</th>
                                        <th>Periodo de Pago</th>
                                        <th>Interes</th>
                                        <th>Total</th>
                                        <th>Acciones</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr id="itemPlaceholder" runat="server"></tr>
                                </tbody>
                            </table>
                            <asp:DataPager ID="dpEventos" PagedControlID="lvPrestamos" runat="server" PageSize="15">
                                <Fields>
                                    <asp:NextPreviousPagerField
                                        ButtonType="Link"
                                        ShowFirstPageButton="true"
                                        ShowLastPageButton="true"
                                        ShowNextPageButton="true"
                                        ShowPreviousPageButton="true" />
                                </Fields>
                            </asp:DataPager>
                        </LayoutTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lblIdPrestamo" runat="server" Text='<%# Eval("Id") %>' Visible="false"></asp:Label>
                            <tr>
                                <td><%#Item.FechRegistro.ToShortDateString() %></td>
                                <td><%#Item.NroCuotas %></td>
                                <td><%#Item.Monto %></td>
                                <td><%#Item.PeriodoPago %></td>
                                <td><%#Item.TasaInteres %></td>
                                <td><%#Item.Total %></td>
                                <td>
                                    <a href="#">Cuotas</a>
                                    <button type="button" class="btn btn-danger" data-toggle="collapse" data-target="#pnlCuotas">
                                        Cuotas
                                    </button>
                                    <%--<a href="frmRegistrarEvento.aspx?idEvento=<%#Item.Id %>&opc=editar" class="glyphicon glyphicon-pencil label label-warning">&nbsp;Editar</a>--%>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="7">
                                    <asp:ListView ID="lvCuotas"
                                        ItemType="Triunfadores.BusinessEntities.CuotaPago"
                                        runat="server"
                                        SelectMethod="GetCuotasPagoByIdPrestamo">
                                        <EmptyDataTemplate>
                                        </EmptyDataTemplate>
                                        <LayoutTemplate>
                                            <div class="collapse in" id="pnlCuotas" class="panel panel-default">
                                                <div class="panel-heading">Cuotas de Pago</div>
                                                <div class="panel-body">
                                                    <table class="table table-hover table-condensed">
                                                        <thead>
                                                            <tr>
                                                                <th>Fecha</th>
                                                                <th>Monto</th>
                                                                <th>Interes</th>
                                                                <th>Total</th>
                                                                <th>Estado</th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <tr id="itemPlaceholder" runat="server" />
                                                        </tbody>
                                                    </table>
                                                </div>
                                            </div>

                                        </LayoutTemplate>
                                        <ItemTemplate>
                                            <tr>
                                                <td>
                                                    <asp:Label ID="lblFechaPago" Text="<%# Bind('FechaPago','{0:d}') %>" runat="server" />
                                                </td>
                                                <td>
                                                    <asp:Label ID="lblMonto" Text="<%# Bind('Monto') %>" runat="server" />
                                                </td>
                                                <td>
                                                    <asp:Label ID="lblInteres" Text="<%# Bind('Interes') %>" runat="server" />
                                                </td>
                                                <td>
                                                    <asp:Label ID="lblTotal" Text="<%# Bind('Total') %>" runat="server" />
                                                </td>
                                                <td>
                                                    <asp:Label ID="lblEstado" Text="<%# Bind('Estado') %>" runat="server" />
                                                </td>
                                            </tr>
                                        </ItemTemplate>
                                    </asp:ListView>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:ListView>
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="btnBuscarSocio" EventName="Click" />
                </Triggers>
            </asp:UpdatePanel>
        </div>
    </div>

</asp:Content>
